<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('维保报告书联系单列表')" />
    <link rel="stylesheet" href="../../../../../../../../../../../../css/Test.css">
</head>
<body class="gray-bg animated fadeInRight" style="background: white">
     <div class="container-div">
         <div class="detail" style="margin-bottom: 10px; margin-top:15px">
             <a class="btn btn-info btn-outline visible-xs-block" href="#" onclick="$.modal.closeTab()">返回</a>
             <nav class="nav" style="font-size: 15px; box-shadow: 0px 0px 0px 1px black;">
                 <a href="#" class="nav-item" active-color="orange" id="detail">详情</a>
                 <a href="#" class="nav-item" active-color="rebeccapurple" id="sheet" style="color: black">报告书联系单</a>
                 <a href="#" class="nav-item" active-color="rebeccapurple" id="engineers">维修工程</a>
                 <a href="#" class="nav-item" active-color="rebeccapurple" id="contact">维保项目合同</a>
             </nav>
         </div>
        <div class="row">
            <div class="col-sm-12 search-collapse" style="display: none">
                <form id="formId" th:object="${mtId}">
                    <div class="select-list">
                        <ul>
<!--                            <li>-->
<!--                                <label>维保报告书 ：</label>-->
<!--                                <input type="text" name="mMreport"/>-->
<!--                            </li>-->
<!--                            <li>-->
<!--                                <label>维保联系单：</label>-->
<!--                                <input type="text" name="mMcontactSheet"/>-->
<!--                            </li>-->
<!--                            <li>-->
<!--                                <label>维保费申请支付联系单：</label>-->
<!--                                <input type="text" name="mMforPayment"/>-->
<!--                            </li>-->
<!--                            <li>-->
<!--                                <label>排查问题联系单：</label>-->
<!--                                <input type="text" name="mCheckProblem"/>-->
<!--                            </li>-->
                            <li class="select-time">
                                <label>创建时间：</label>
                                <input type="text" class="time-input" id="startTime" placeholder="开始时间" name="params[beginMTime]"/>
                                <span>-</span>
                                <input type="text" class="time-input" id="endTime" placeholder="结束时间" name="params[endMTime]"/>
                            </li>
<!--                            <li>-->
<!--                                <label>外键id：</label>-->
<!--                                <input type="text" name="mtId"/>-->
<!--                            </li>-->
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

            <div class="btn-group-sm" id="toolbar" role="group">
                <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="ruoyi:sheet:add">
                    <i class="fa fa-plus"></i> 添加上传
                </a>
<!--                <a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="ruoyi:sheet:edit">-->
<!--                    <i class="fa fa-edit"></i> 修改-->
<!--                </a>-->
                <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="ruoyi:sheet:remove">
                    <i class="fa fa-remove"></i> 删除
                </a>
<!--                <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="ruoyi:sheet:export">-->
<!--                    <i class="fa fa-download"></i> 导出-->
<!--                </a>-->
            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('ruoyi:sheet:edit')}]];
        //var editFlags = [[${@permission.hasPermi('ruoyi:sheet:edits')}]];
        var removeFlag = [[${@permission.hasPermi('ruoyi:sheet:remove')}]];
        var prefix = ctx + "ruoyi/sheet";
        var mtId=[[*{mtId}]];
        //详情
        $("#detail").click(function () {
            location.href="/ruoyi/build/detail/" + mtId
        });
        //报告书联系单
        $("#sheet").click(function () {
            location.href= "/ruoyi/sheet/sheet/" + mtId;
        });
        //维修工程
        $("#engineers").click(function () {
            location.href="/ruoyi/engineers/engineers/" + mtId
        });
        //维保项目合同
        $("#contact").click(function () {
            location.href="/ruoyi/contact/contact/" + mtId
        });
        $(function() {
            var options = {
                url: prefix + "/lists/"+mtId,
                createUrl: prefix + "/add/"+mtId,
                updateUrl: prefix + "/edit/{id}",
                //updateUrls:prefix + "/edits/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                modalName: "维保报告书联系单",
                showColumns: false,
                columns: [{
                    checkbox: true
                },
                {
                    field: 'mId',
                    title: '报告书id',
                    visible: false
                },
                {
                    field: 'mMreport',
                    title: '维保报告书',
                    formatter: function(value, row, index) {
                        var actions = [];
                        if(row.mMreport==null){
                            actions.push('未上传');
                            return actions.join('');
                        }else{
                            return $.table.imageView(value);
                        }
                    }
                },
                {
                    field: 'mMcontactSheet',
                    title: '维保联系单',
                    formatter: function(value, row, index) {
                        var actions = [];
                        if(row.mMcontactSheet==null){
                            actions.push('未上传');
                            return actions.join('');
                        }else{
                            return $.table.imageView(value);
                        }
                    }
                },
                {
                    field: 'mMforPayment',
                    title: '维保费申请支付联系单',
                    formatter: function(value, row, index) {
                        var actions = [];
                        if(row.mMforPayment==null){
                            actions.push('未上传');
                            return actions.join('');
                        }else{
                            return $.table.imageView(value);
                        }
                    }
                },
                {
                    field: 'mCheckProblem',
                    title: '排查问题联系单',
                    formatter: function(value, row, index) {
                        var actions = [];
                        if(row.mCheckProblem==null){
                            actions.push('未上传');
                            return actions.join('');
                        }else{
                            return $.table.imageView(value);
                        }
                    }
                },
                {
                    field: 'mTime',
                    title: '创建时间'
                },
                {
                    field: 'mtId',
                    title: '外键id',
                    visible: false
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        // 谁为空 显示谁的修改上传按钮
                        if(row.mMreport==null&&row.mMcontactSheet!=null&&row.mMforPayment!=null&&row.mCheckProblem!=null){//维保报告书为空 显示维保报告书修改上传的按钮
                            actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.mId + '\')"><i class="fa fa-edit"></i>报告书上传</a> ');
                            actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.mId + '\')"><i class="fa fa-remove"></i>删除</a>');
                        }else if(row.mMreport!=null&&row.mMcontactSheet==null&&row.mMforPayment!=null&&row.mCheckProblem!=null){//维保联系单为空 显示维保联系单修改上传按钮
                            actions.push('<a class="btn btn-success btn-xs " href="javascript:void(0)" onclick="edits(\'' + row.mId + '\')"><i class="fa fa-edit"></i>联系单上传</a> ');
                            actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.mId + '\')"><i class="fa fa-remove"></i>删除</a>');
                        }else if(row.mMreport!=null&&row.mMcontactSheet!=null&&row.mMforPayment==null&&row.mCheckProblem!=null){// 维保费申请支付联系单为空 显示维保费申请支付联系单修改上传按钮
                            actions.push('<a class="btn btn-success btn-xs " href="javascript:void(0)" onclick="editss(\'' + row.mId + '\')"><i class="fa fa-edit"></i>申请支付联系单上传</a> ');
                            actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.mId + '\')"><i class="fa fa-remove"></i>删除</a>');
                        }else if(row.mMreport!=null&&row.mMcontactSheet!=null&&row.mMforPayment!=null&&row.mCheckProblem==null){//排查问题联系单为空  显示排查问题联系单修改上传按钮
                            actions.push('<a class="btn btn-success btn-xs " href="javascript:void(0)" onclick="editsss(\'' + row.mId + '\')"><i class="fa fa-edit"></i>排查问题联系单上传</a> ');
                            actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.mId + '\')"><i class="fa fa-remove"></i>删除</a>');
                        }else if(row.mMreport!=null&&row.mMcontactSheet!=null&&row.mMforPayment==null&&row.mCheckProblem==null){//维保费申请支付单 and 排查问题联系单为空时 显示这俩修改上传按钮
                            actions.push('<a class="btn btn-success btn-xs " href="javascript:void(0)" onclick="editss(\'' + row.mId + '\')"><i class="fa fa-edit"></i>申请支付联系单上传</a> ');
                            actions.push('<a class="btn btn-success btn-xs " href="javascript:void(0)" onclick="editsss(\'' + row.mId + '\')"><i class="fa fa-edit"></i>排查问题联系单上传</a> ');
                            actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.mId + '\')"><i class="fa fa-remove"></i>删除</a>');
                        }else if(row.mMreport!=null&&row.mMcontactSheet==null&&row.mMforPayment!=null&&row.mCheckProblem==null){//维保联系单 and 排查问题联系单为空时 显示这俩修改上传按钮
                            actions.push('<a class="btn btn-success btn-xs " href="javascript:void(0)" onclick="edits(\'' + row.mId + '\')"><i class="fa fa-edit"></i>联系单上传</a> ');
                            actions.push('<a class="btn btn-success btn-xs " href="javascript:void(0)" onclick="editsss(\'' + row.mId + '\')"><i class="fa fa-edit"></i>排查问题联系单上传</a> ');
                            actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.mId + '\')"><i class="fa fa-remove"></i>删除</a>');
                        }else if(row.mMreport!=null&&row.mMcontactSheet==null&&row.mMforPayment==null&&row.mCheckProblem!=null){//维保联系单 and 维保费申请支付单为空时  显示这俩修改上传按钮
                            actions.push('<a class="btn btn-success btn-xs " href="javascript:void(0)" onclick="edits(\'' + row.mId + '\')"><i class="fa fa-edit"></i>联系单上传</a> ');
                            actions.push('<a class="btn btn-success btn-xs " href="javascript:void(0)" onclick="editss(\'' + row.mId + '\')"><i class="fa fa-edit"></i>申请支付联系单上传</a> ');
                            actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.mId + '\')"><i class="fa fa-remove"></i>删除</a>');
                        }else if(row.mMreport==null&&row.mMcontactSheet!=null&&row.mMforPayment!=null&&row.mCheckProblem==null){//维保报告书 and 排查问题联系单为空时 显示这俩修改上传按钮
                            actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.mId + '\')"><i class="fa fa-edit"></i>报告书上传</a> ');
                            actions.push('<a class="btn btn-success btn-xs " href="javascript:void(0)" onclick="editsss(\'' + row.mId + '\')"><i class="fa fa-edit"></i>排查问题联系单上传</a> ');
                            actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.mId + '\')"><i class="fa fa-remove"></i>删除</a>');
                        }else if(row.mMreport==null&&row.mMcontactSheet!=null&&row.mMforPayment==null&&row.mCheckProblem!=null){//维保报告书 and 维保费申请支付单为空时 显示这俩修改上传按钮
                            actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.mId + '\')"><i class="fa fa-edit"></i>报告书上传</a> ');
                            actions.push('<a class="btn btn-success btn-xs " href="javascript:void(0)" onclick="editss(\'' + row.mId + '\')"><i class="fa fa-edit"></i>申请支付联系单上传</a> ');
                            actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.mId + '\')"><i class="fa fa-remove"></i>删除</a>');
                        }else if(row.mMreport==null&&row.mMcontactSheet==null&&row.mMforPayment!=null&&row.mCheckProblem!=null){//维保报告书 and 维保联系单为空时 显示这俩修改上传按钮
                            actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.mId + '\')"><i class="fa fa-edit"></i>报告书上传</a> ');
                            actions.push('<a class="btn btn-success btn-xs " href="javascript:void(0)" onclick="edits(\'' + row.mId + '\')"><i class="fa fa-edit"></i>联系单上传</a> ');
                            actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.mId + '\')"><i class="fa fa-remove"></i>删除</a>');
                        }else if(row.mMreport==null&&row.mMcontactSheet==null&&row.mMforPayment==null&&row.mCheckProblem!=null){//维保报告书 and 维保联系单 and 维保费申请支付单  为空时 显示这三个修改上传按钮
                            actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.mId + '\')"><i class="fa fa-edit"></i>报告书上传</a> ');
                            actions.push('<a class="btn btn-success btn-xs " href="javascript:void(0)" onclick="edits(\'' + row.mId + '\')"><i class="fa fa-edit"></i>联系单上传</a> ');
                            actions.push('<a class="btn btn-success btn-xs " href="javascript:void(0)" onclick="editss(\'' + row.mId + '\')"><i class="fa fa-edit"></i>申请支付联系单上传</a> ');
                            actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.mId + '\')"><i class="fa fa-remove"></i>删除</a>');
                        }else if(row.mMreport==null&&row.mMcontactSheet==null&&row.mMforPayment!=null&&row.mCheckProblem==null){//维保报告书 and 维保联系单 and 排查问题联系单为空时 显示这三个修改上传按钮
                            actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.mId + '\')"><i class="fa fa-edit"></i>报告书上传</a> ');
                            actions.push('<a class="btn btn-success btn-xs " href="javascript:void(0)" onclick="edits(\'' + row.mId + '\')"><i class="fa fa-edit"></i>联系单上传</a> ');
                            actions.push('<a class="btn btn-success btn-xs " href="javascript:void(0)" onclick="editsss(\'' + row.mId + '\')"><i class="fa fa-edit"></i>排查问题联系单上传</a> ');
                            actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.mId + '\')"><i class="fa fa-remove"></i>删除</a>');
                        }else if(row.mMreport==null&&row.mMcontactSheet!=null&&row.mMforPayment==null&&row.mCheckProblem==null){//维保报告书 and 维保费申请支付单 and 排查问题联系单为空时 显示这三个修改上传按钮
                            actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.mId + '\')"><i class="fa fa-edit"></i>报告书上传</a> ');
                            actions.push('<a class="btn btn-success btn-xs " href="javascript:void(0)" onclick="editss(\'' + row.mId + '\')"><i class="fa fa-edit"></i>申请支付联系单上传</a> ');
                            actions.push('<a class="btn btn-success btn-xs " href="javascript:void(0)" onclick="editsss(\'' + row.mId + '\')"><i class="fa fa-edit"></i>排查问题联系单上传</a> ');
                            actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.mId + '\')"><i class="fa fa-remove"></i>删除</a>');
                        }else if(row.mMreport!=null&&row.mMcontactSheet==null&&row.mMforPayment==null&&row.mCheckProblem==null){//维保联系单 and 维保费申请支付单 and 排查问题联系单为空时 显示这三个修改上传按钮
                            actions.push('<a class="btn btn-success btn-xs " href="javascript:void(0)" onclick="edits(\'' + row.mId + '\')"><i class="fa fa-edit"></i>联系单上传</a> ');
                            actions.push('<a class="btn btn-success btn-xs " href="javascript:void(0)" onclick="editss(\'' + row.mId + '\')"><i class="fa fa-edit"></i>申请支付联系单上传</a> ');
                            actions.push('<a class="btn btn-success btn-xs " href="javascript:void(0)" onclick="editsss(\'' + row.mId + '\')"><i class="fa fa-edit"></i>排查问题联系单上传</a> ');
                            actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.mId + '\')"><i class="fa fa-remove"></i>删除</a>');
                        }else{
                            actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.mId + '\')"><i class="fa fa-remove"></i>删除</a>');
                        }
                        return actions.join('');
                    }
                }]
            };
            $.table.init(options);
        });
        //维保联系单
        function edits(mId) {
            var url = prefix + "/edits/"+mId;
            $.modal.open("联系单上传",url);
        }
        //维保费申请支付联系单
        function editss(mId) {
            var url = prefix + "/editss/"+mId;
            $.modal.open("申请支付联系单上传",url);
        }
        //排查问题联系单
        function editsss(mId) {
            var url = prefix + "/editsss/"+mId;
            $.modal.open("排查问题联系单上传",url);
        }
    </script>
</body>
</html>